<template>
	<view>
		<view class="u-p-t-40 u-p-b-10 u-p-l-40" style="position: relative;">
			<image src="/static/znkf.png" style="width: 650rpx;height: 124rpx;"></image>
		</view>
		<view class="cate bg-white u-m-t-30 u-m-l-30 u-m-r-30 u-p-l-30 u-p-r-30" v-for="(item, index) in helpCateList" :key="index" :style="{background: vk.getVuex('$app.config.bg.tab')}">
			<view class="u-p-t-30 u-p-b-30">
				<u-section :title="item.title" :color="vk.getVuex('$app.config.color.main')" :line-color="vk.getVuex('$app.config.color.sec')" :bold="false" font-size="32" :right="false"></u-section>
			</view>
			<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-top" 
			:style="{borderColor: vk.getVuex('$app.config.color.border')}"
			v-for="(ite, inde) in helpList" 
			:key="inde" v-if="ite.help_id == item._id" 
			@click="helpClick(ite._id)">
				<view class="cont">{{ite.title}}</view>
				<text class="arror-right"></text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpList: [],
				helpCateList: [],
			}
		},
		onLoad() {
			this.getHelpCateList()
			this.getHelpList()
		},
		methods: {
			async getHelpCateList(){
				var that = this
				let data = await that.vk.callFunction({
					url: 'client/wechat/list/pub/getList',
					data:{
						dbName: 'bus-wx-help',
						pageIndex: that.pageIndex,
						pageSize: 500,
						whereJson: {
							mode: 0,
							status: 1
						},
						sortArr: [{name: '_add_time', type: 'asc'}]
					},
				});
				that.helpCateList = data.rows
			},
			async getHelpList(){
				var that = this
				let data = await that.vk.callFunction({
					url: 'client/wechat/list/pub/getList',
					data:{
						dbName: 'bus-wx-help',
						pageIndex: that.pageIndex,
						pageSize: 500,
						whereJson: {
							mode: 1,
							status: 1
						},
						sortArr: [{name: '_add_time', type: 'asc'}]
					},
				});
				that.helpList = data.rows
			},
			helpClick(id){
				uni.navigateTo({
					url: '/pages/help/detail?id='+id
				})
			},
		}
	}
</script>

<style lang="scss">
	.bg-white{
		background-color: #282828;
		border-radius: 20rpx;
	}
	
	.arror-right{
		width: 15rpx;
		height: 15rpx;
		border-top: 3rpx solid #909399;
		border-right: 3rpx solid #909399;
		transform: rotate(45deg);
	}
	.cate{
		position: relative;
	}
	.border-top{
		border-top: 1rpx dashed #1F1F1F;
	}
	.title{
		font-weight: 550;
		color: #bdbdbd;
	}
	.cont{
		color: #909399;
		width: 90%;
	}
</style>
